﻿//using System;
//using System.Collections.ObjectModel;
//using System.ServiceModel;
//using System.ServiceModel.Channels;
//using System.ServiceModel.Description;
//using System.ServiceModel.Dispatcher;

//namespace Lari.Services.Utility
//{
//    [AttributeUsage(AttributeTargets.Class)]
//    public sealed class ErrorHandlingBehaviorAttribute : Attribute, IServiceBehavior
//    {
//        private Type _exceptionToFaultConverterType;
//        private string applicationName = "Lari Application";

//        public bool EnforceFaultContract { get { return false; } set { } }
//        public string ApplicationName
//        {
//            get
//            {
//                return applicationName;
//            }
//            set
//            {
//                applicationName = value;
//            }
//        }
//        public Type ExceptionToFaultConverter
//        {
//            get
//            {
//                return _exceptionToFaultConverterType;
//            }
//            set
//            {
//                if (!typeof(IExceptionToFaultConverter).IsAssignableFrom(value))
//                    throw new ArgumentException("Fault converter doesn't implement IExceptionToFaultConverter.", "value");
//                _exceptionToFaultConverterType = value;
//            }
//        }

//        #region IServiceBehavior Members

//        public void AddBindingParameters(ServiceDescription serviceDescription,
//            ServiceHostBase serviceHostBase, Collection<ServiceEndpoint> endpoints,
//            BindingParameterCollection bindingParameters)
//        {
//        }

//        public void ApplyDispatchBehavior(ServiceDescription serviceDescription,
//            ServiceHostBase serviceHostBase)
//        {
//            foreach (ChannelDispatcherBase chanDispBase in serviceHostBase.ChannelDispatchers)
//            {
//                ChannelDispatcher channelDispatcher = chanDispBase as ChannelDispatcher;
//                if (channelDispatcher == null)
//                    continue;
//                channelDispatcher.ErrorHandlers.Add(new ErrorHandler(this));
//            }
//        }

//        public void Validate(ServiceDescription serviceDescription, ServiceHostBase serviceHostBase)
//        {
//        }

//        #endregion

//        #region IServiceBehavior Members


//        #endregion
//    }

//}
